function [constant] = compile_3d_constant_toolbox(patient);
    
    if patient.par_toolbox>0
        
        pctRunOnAll javaaddpath E:\ParforProgMonv2\java
        progressStepSize = 1;
        ppm = ParforProgMon('                        Lung: ',patient.dim(1),  progressStepSize,300, 80);
        
        parfor slice=1:patient.dim(1);
            
            %     display(sprintf('Slice %d',slice));
            constant_slice=load([patient.model_params_folder sprintf('/constant_%d',slice)]);
            constant_u(slice,:,:)=squeeze(constant_slice.data(:,:,1));
            constant_v(slice,:,:)=squeeze(constant_slice.data(:,:,2));
            constant_w(slice,:,:)=squeeze(constant_slice.data(:,:,3));
            
            %     beta_slice_vec=bsxfun(@hypot,squeeze(beta_slice.data(:,:,1)),bsxfun(@hypot,squeeze(beta_slice.data(:,:,2)),squeeze(alpha_slice.data(:,:,3))));
            %     beta_vec(slice,:,:)=beta_slice_vec;
            ppm.increment();
            
        end
        
    else
        for slice=1:patient.dim(1);
            
            %     display(sprintf('Slice %d',slice));
            constant_slice=load([patient.model_params_folder sprintf('/constant_%d',slice)]);
            constant_u(slice,:,:)=squeeze(constant_slice.data(:,:,1));
            constant_v(slice,:,:)=squeeze(constant_slice.data(:,:,2));
            constant_w(slice,:,:)=squeeze(constant_slice.data(:,:,3));
            
            %     beta_slice_vec=bsxfun(@hypot,squeeze(beta_slice.data(:,:,1)),bsxfun(@hypot,squeeze(beta_slice.data(:,:,2)),squeeze(alpha_slice.data(:,:,3))));
            %     beta_vec(slice,:,:)=beta_slice_vec;    ppm.increment();
            
        end
    end
    constant.u = constant_u; clear constant_u;
    constant.v = constant_v; clear constant_v;
    constant.w = constant_w; clear constant_w;
    
    save([patient.model_params_folder '/constant'], 'constant')
